<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="tags" tagdir="/WEB-INF/tags"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="spring" uri="http://www.springframework.org/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%><head>
	<title><fmt:message key="account" /></title>
</head>
<body>
	<c:url value="/domain/account/update/${account.primaryKey}" var="updateUrl"/>
	<form:form action="${updateUrl}" modelAttribute="account" method="POST">
		<form:errors cssClass="error"/>
		<table class="edit">
			<form:hidden path="accountId"/>
			<form:hidden path="version"/>
			<tbody>
				<tr>
					<th><fmt:message key="account_addressId" /></th>	
					<td>
						<form:select path="mainAddress" cssClass="number">
							<form:option value="" label=""/>
							<form:options items="${mainAddresses}" itemValue="primaryKey"/>
						</form:select>
						<form:errors path="mainAddress" cssClass="error"/>
					</td>
				</tr>
				<tr class="odd">
					<th><fmt:message key="account_username" /> <em>*</em></th>	
					<td>
						<form:input path="username" cssClass="required {maxlength: 255}"/>
						<form:errors path="username" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th><fmt:message key="account_password" /> <em>*</em></th>	
					<td>
						<form:password path="password" cssClass="required {maxlength: 255}"/>
						<form:errors path="password" cssClass="error"/>
					</td>
				</tr>
				<tr class="odd">
					<th><fmt:message key="account_email" /> <em>*</em></th>	
					<td>
						<form:input path="email" cssClass="email required {maxlength: 255}"/>
						<form:errors path="email" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th><fmt:message key="account_isEnabled" /></th>	
					<td>
						<form:checkbox path="isEnabled"/>
						<form:errors path="isEnabled" cssClass="error"/>
					</td>
				</tr>
				<tr class="odd">
					<th><fmt:message key="account_birthDate" /></th>	
					<td>
						<form:input path="birthDate" cssClass="datepicker"/>
						<form:errors path="birthDate" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th><fmt:message key="account_civility" /></th>	
					<td>
						<form:select path="civility" cssClass="{maxlength: 2 minlength: 2}">
							<form:option value="" label=""/>
							<form:options />
						</form:select>
					</td>
				</tr>
				<tr class="odd">
					<th><fmt:message key="account_firstName" /></th>	
					<td>
						<form:input path="firstName" cssClass="{maxlength: 255}"/>
						<form:errors path="firstName" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th><fmt:message key="account_lastName" /></th>	
					<td>
						<form:input path="lastName" cssClass="{maxlength: 255}"/>
						<form:errors path="lastName" cssClass="error"/>
					</td>
				</tr>
				<tr class="odd">
					<th><fmt:message key="account_yearsOfExperience" /></th>	
					<td>
						<form:input path="yearsOfExperience" cssClass="number"/>
						<form:errors path="yearsOfExperience" cssClass="error"/>
					</td>
				</tr>
				<tr>
					<th><fmt:message key="book" /></th>
					<td>
						<ul class="inline">
							<c:forEach items="${account.favoriteBooks}" var="favoriteBook" varStatus="status">
								<spring:bind path="account.favoriteBooks[${status.index}]">
									<spring:transform value="${favoriteBook}" var="favoriteBookFormatted"/>
									<li>
										<tags:a href="/domain/book/show/${favoriteBook.primaryKey}" text="${favoriteBookFormatted}" cssClass="ajaxLink"/>
									</li>
								</spring:bind>
							</c:forEach>
						</ul>
					</td>
				</tr>
				<tr>
					<th><fmt:message key="role" /></th>
					<td>
						<form:select path="roles" multiple="true">
							<form:options items="${roles}" itemValue="primaryKey"/>
						</form:select>
						<form:errors cssClass="error" path="roles"/>
					</td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="2">
						<tags:button type="submit" key="crud.save.button" icon="save"/>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<tags:a href="/domain/account/show/${account.primaryKey}" key="crud.show.button" cssClass="ajaxLink" icon="ok"/>
						<tags:a href="/domain/account/createForm" key="crud.create.button" cssClass="ajaxLink" icon="add"/>
						<tags:a href="/domain/account/delete/${account.primaryKey}" key="crud.delete.button" cssClass="ajaxModal" icon="delete"/>
					</td>
				</tr>
			</tfoot>
		</table>
	</form:form>
</body>
